
def to_num(num_str):
        num = 0
        for i in range(len(num_str)):
            if num_str[i] >= '0' and num_str[i] <= '9':
                num = num * 10 + int(num_str[i])
        return num
    
def adapter_user_info(data):
    data['user_id'] = data['id']
    data['name'] = data['screen_name']
    
    if data['avatar_large'].find('default') == -1:
        data['is_avatar'] = 1
    else:
        data['is_avatar'] = 0
        
    status_total_counter = data['status_total_counter']
    data['comment_count'] = to_num(status_total_counter['comment_cnt'])
    data['repost_count'] = to_num(status_total_counter['repost_cnt'])
    data['like_count'] = to_num(status_total_counter['like_cnt'])
    data['social_activity_total'] = to_num(status_total_counter['total_cnt'])
    return data
    
